#
# Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
#
# GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
# Author: Shawn.Tan
# Date: 2025.10.28
#
# History: Initial Version 2025.10.28
#
#
from VectorTestSequence import VectorVsetvlTestSequence
from gpgpu.EnvGPGPU import EnvGPGPU
from gpgpu.GenThreadGPGPU import GenThreadGPGPU


# This test verifies the VSETIVLI instruction sets the vl and vtype registers as expected.
class MainSequence(VectorVsetvlTestSequence):
    def __init__(self, aGenThread, aName=None):
        super().__init__(aGenThread, aName)

        self._mInstrList = ("VSETIVLI##CALM",)

    # Return a list of test instructions to randomly choose from.
    def _getInstructionList(self):
        return self._mInstrList

    # Generate parameters to be passed to Sequence.genInstruction() and load register operands.
    def _generateInstructionParameters(self):
        instr_params = {}

        instr_params["uimm5"] = self.mAvl
        instr_params["zimm10"] = self.mVtype

        return instr_params

    # Return the maximum allowable value for AVL. This generally depends on the instruction to be
    # generated.
    def _get_max_avl(self):
        return 0x1F


MainSequenceClass = MainSequence
GenThreadClass = GenThreadGPGPU
EnvClass = EnvGPGPU
